package com.chengcang.api.modules.sys.controller;

import com.chengcang.api.common.annotation.Login;
import com.chengcang.api.modules.sys.service.SysTenantService;
import com.chengcang.api.modules.sys.vo.SysTenantVO;
import com.chengcang.common.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author fankunfeng
 * @date 2023-02-14 09:52:56
 **/
@RestController
@Api(tags = "客户管理")
@RequiredArgsConstructor
@RequestMapping("tenant")
public class SysTenantController {

    private final SysTenantService sysTenantService;

    /**
     * 根据供应商名称模糊查询
     *
     * @param
     * @return
     */
    @GetMapping("getTenantByTenantName")
    @ApiOperation("根据供应商名称模糊查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "客户名称", paramType = "query", dataType = "String")
    })
    @Login
    public Result<List<SysTenantVO>> getTenantByTenantName(@RequestParam(required = false) String name) {
        return new Result().ok(sysTenantService.getTenantByTenantName(name));
    }
}
